package com.monitor.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.monitor.entity.ErpOrderd;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 需求汇总表 Mapper 接口
 * </p>
 *
 * @author LX
 * @since 2018-09-11
 */
public interface ErpOrderdMapper extends BaseMapper<ErpOrderd> {


    @Select("SELECT orderd.id FROM erp_orderd orderd LEFT JOIN erp_orderd_materiel materiel ON orderd.id=materiel.order_id WHERE materiel.materiel_name=#{materielName}  and materiel.materiel_brand=#{materielBrand}" +
            "    and  materiel.materiel_Specifications=#{specifications} and materiel.materiel_model=#{model}")
    List<Integer> getOrderdId(@Param("materielName") String materielName, @Param("materielBrand")String materielBrand, @Param("specifications")String specifications,@Param("model") String model);

    @Select("SELECT o.id as orderdId,c.id as clientsId from erp_orderd o, erp_clients c where o.sheet_id=c.sheet_id and o.grounp=#{gro} and o.customer_id=#{custId} and o.word_state=0")
    public List<Map<String, Object>> selectByGroupAndCustId(@Param("gro")String gro,@Param("custId")int custId);
}
